#pragma once
#include <event2/listener.h>
#include <event2/bufferevent.h>

void signal_cb(evutil_socket_t fd, short what, void* arg);
void conn_readcb(struct bufferevent *bev, void *ctx);
void conn_eventcb(struct bufferevent *bev, short what, void *ctx);
void listener_cb(struct evconnlistener* listener, evutil_socket_t cfd, struct sockaddr* client, int client_len, void*arg);
int get_line(struct bufferevent *bev, char* buf, int size);
void response_http(struct bufferevent *bev, char* method, char* path, char* param);
void send_response_head(struct bufferevent *bev , int no, const char* desp, const char*type, long len);
void decode_str(char *to, char * from);
void encode_str(char* to, int tosize, const char* from);
int hexit(char c);
void send_dir(struct bufferevent* bev, const char* dirname);
void send_file(struct bufferevent* bev, const char* filename);
const char* get_file_type(const char* name);
char* buftostr(char* buf, int buflen);